<?php


namespace App\Http\Requests;


abstract class PKRequest extends PackingRequest
{
    abstract protected function getPK();

    public function rules()
    {
        $pk = $this->getPK();
        return [
            $pk => 'required|integer|min:1',
        ];
    }

    public function messages()
    {
        $pk = $this->getPK();
        return [
            "{$pk}.required" => '缺少记录ID参数',
            "{$pk}.integer"  => '记录ID参数类型异常',
            "{$pk}.min"  => '记录ID参数类型异常'
        ];
    }
}
